#include<stdio.h>
#include<string.h>

int a[1000100],b[1000100],c[1000100];

int main()
{
	int n,i,j,begin,end,maxi,num,p,q;
	while (scanf("%d",&n)==1)
	{
		for (i=0;i<1000100;i++)
			a[i]=-1;
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		for (i=0;i<n;i++)
			scanf("%d",&a[i]);
		begin=0;
		end=0;
		maxi=0;
		for (i=0;i<n;i++)
		{
			if (b[a[i]]==0)
			{
				b[a[i]]=1;
				c[a[i]]=i;
				end++;
				num=end-begin;
			}
			else 
			{
				for (j=begin;j<c[a[i]];j++)
					b[a[j]]=0;
				begin=c[a[i]]+1;
				c[a[i]]=i;
				end++;
			}
			if (maxi<num)
			{
				maxi=num;
				p=begin;
				q=end-1;
			}
		}
		printf("%d\n%d %d\n",maxi,p,q);
	}
	return 0;
}
